﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;

using TimKen.App;
using TimKen.BussLogic;

namespace TimKen.Web.UserControls
{
    public partial class CategoryList : BaseUserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                BindData();
        }

        public int  ParentCategoryID
        {
            get
            {
                if (ViewState["ParentCategoryID"] != null && TypeParse.IsNumeric(ViewState["ParentCategoryID"]))
                    return Convert.ToInt32(ViewState["ParentCategoryID"]);
                else
                    return 0;
            }
            set
            {
                ViewState["ParentCategoryID"] = value;
            }
        }

        private void BindData()
        {
            PCategoryManager categoryManager = new PCategoryManager();
            DataSet  ds =  categoryManager.GetList(" ParentID=" + ParentCategoryID + " AND " + LanguageWhereStr);
            this.dlCategory.DataSource = ds;
            this.dlCategory.DataBind();
        }
    }
}